<?php

/**
 * Feat form base class.
 *
 * @method Feat getObject() Returns the current form's model object
 *
 * @package    LIAnnot
 * @subpackage form
 * @author     Cedric Richier
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseFeatForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'           => new sfWidgetFormInputHidden(),
      'id_annoset'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Annoset'), 'add_empty' => false)),
      'paula_id'     => new sfWidgetFormInputText(),
      'base'         => new sfWidgetFormInputText(),
      'list_type'    => new sfWidgetFormInputText(),
      'multiFeat_id' => new sfWidgetFormInputText(),
      'att_id'       => new sfWidgetFormInputText(),
      'href'         => new sfWidgetFormInputText(),
      'name'         => new sfWidgetFormInputText(),
      'value'        => new sfWidgetFormInputText(),
      'target'       => new sfWidgetFormInputText(),
      'description'  => new sfWidgetFormTextarea(),
      'example'      => new sfWidgetFormTextarea(),
    ));

    $this->setValidators(array(
      'id'           => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'id_annoset'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Annoset'))),
      'paula_id'     => new sfValidatorString(array('max_length' => 80)),
      'base'         => new sfValidatorString(array('max_length' => 80, 'required' => false)),
      'list_type'    => new sfValidatorString(array('max_length' => 40)),
      'multiFeat_id' => new sfValidatorString(array('max_length' => 40, 'required' => false)),
      'att_id'       => new sfValidatorString(array('max_length' => 40, 'required' => false)),
      'href'         => new sfValidatorString(array('max_length' => 80)),
      'name'         => new sfValidatorString(array('max_length' => 80, 'required' => false)),
      'value'        => new sfValidatorString(array('max_length' => 80, 'required' => false)),
      'target'       => new sfValidatorString(array('max_length' => 80, 'required' => false)),
      'description'  => new sfValidatorString(array('required' => false)),
      'example'      => new sfValidatorString(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('feat[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Feat';
  }

}
